/**
 * Copyright (c) 2018-present, Chen Guodong
 * All rights reserved.
 *
 * @flow
 */


<template>
  <div class="content">
    <div class="header">
      <NavBar :title="title">
        <router-link slot="left" to="/message" style="width: 100%;text-align: center;">
          <i class="iconfont icon-arrow-left" style="font-size: 20px;"></i>
        </router-link>
      </NavBar>
    </div>
    <div class="main">
      <ul class="details-box">
        <li v-for="(item, index) in detailData" :key="index">
          <p class="date">{{getTime(item.time)}}</p>
          <div class="wrap">
            <p :class="['title', item.new ? 'new' : '']">{{item.title}}</p>
            <p class="info" v-if="item.info">{{item.info}}</p>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import NavBar from "../../components/NavBar/NavBar";
import { getUrlAllParams } from "../../util/util.js";
import messageDetail from "../../mock/messageDetail.js";
import {getTime} from '../../util/util.js';

export default {
  name: "messageDetail",
  data() {
    return {
      title: "",
      detailData: []
    };
  },
  methods:{
    getTime: getTime
  },
  mounted() {
    const query = getUrlAllParams();
    this.title = query.text;
    this.detailData = messageDetail.data;
  },
  components: {
    NavBar
  }
};
</script>

<style lang='less' scoped>
@import "../../util/themt.less";
.content {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  .header {
    height: 46px;
    width: 100%;
    overflow: hidden;
    position: relative;
  }
  .main {
    height: calc(~"100% - 46px");
    width: 100%;
    position: relative;
    overflow: auto;
  }
}
.details-box {
  li {
    padding: 10px;
    .date {
      text-align: center;
      font-size: 14px;
      color: @font-secondary;
      margin: 0 0 10px;
    }
    .wrap {
      background: #fff;
      border-radius: 5px;
      padding: 15px;
      .title {
        font-size: 16px;
        color: @font-regular;
        position: relative;
        margin-bottom: 10px;
        position: relative;
      }
      .new {
        &::after {
          content: "";
          width: 10px;
          height: 10px;
          border-radius: 10px;
          background: red;
          position: absolute;
          right: 0;
          top: 3px;
        }
      }
      .info {
        font-size: 14px;
        color: @font-secondary;
        line-height: 20px;
      }
    }
  }
}
</style>
